package cn.desk.database.service.impl;

import java.sql.SQLException;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cn.desk.commons.service.impl.BaseServiceImpl;
import cn.desk.database.dao.IDatabaseDao;
import cn.desk.database.entity.TableInfo;
import cn.desk.database.service.IDatabaseService;

public class DatabaseServiceImpl<T extends TableInfo> extends
		BaseServiceImpl<T> implements IDatabaseService<T> {
	private IDatabaseDao<T> databaseDao;
	private static final Logger logger = LoggerFactory
			.getLogger(DatabaseServiceImpl.class);

	@Override
	public List<List<String>> executSql(String sql) throws SQLException {
		logger.debug("executSql start");
		try{
			logger.info("sqlText:"+sql);
			return databaseDao.executSql(sql);

		}finally{
			logger.debug("executSql end");
		}
		
	}

	public IDatabaseDao<T> getDatabaseDao() {
		return databaseDao;
	}

	public void setDatabaseDao(IDatabaseDao<T> databaseDao) {
		this.databaseDao = databaseDao;
	}

}
